  {  Petrova Tatjana
     This program works with classes.
     2012 / 11 / 03  }
program Work;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  Rectangle=class
    public
      a,b:integer;
      constructor Create(num,num1:integer);
      procedure Square;virtual;
      procedure Update; virtual;
    private
      S,S1:integer;
  end;
  SmartRectangle=class(Rectangle)
    public
      newa,newb:integer;
      procedure sett(newa, newb : integer);
      procedure Square;override;
    private
  end;
constructor Rectangle.Create(num,num1:integer);
begin
  a:=num;
  b:=num1;
end;
procedure Rectangle.Update;
begin
  S := a*b;
end;
procedure Rectangle.Square;
begin
  writeln(S);
end;
procedure SmartRectangle.sett;
var
  S1,S: integer;
begin
  S1 :=a*b;
  a := newa;
  b := newb;
  S := a*b;
end;
procedure SmartRectangle.Square;
var
  S,S1 : integer;
begin
  if (S = S1) then
  begin
    writeln('Something is wrong.');
    readln;
  end;
end;
var
  r : Rectangle;
begin
  r := Rectangle.Create(10,15);
  r.update;
  r.Square;
  r := SmartRectangle.Create(10,15);
  r.sett;
  r.square;
  readln;

end.

